package com.example.yangjintingtest.mapper;

import com.example.yangjintingtest.domain.Comment;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * @classname CommentRepository
 * @Description TODO
 * @Date 2019-3-4 9:34
 * @Created by CrazyStone
 */
public interface CommentRepository extends JpaRepository<Comment,Integer> {
    // 根据评论id修改评论作者
    @Transactional
    @Modifying
    @Query("UPDATE t_comment c SET c.author=?1 WHERE c.id =?2")
    public int updateComment(String author,Integer id);
}
